package student.aistar.proxy.demo02;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyHandler implements InvocationHandler {
    private Object object = new Object();

    public ProxyHandler(Object object) {
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开启事务");
        System.out.println(proxy.getClass());
        Object o = method.invoke(object, args);
        System.out.println("关闭事务");
        return null;

    }
}
